<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>修改歌单</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../static/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=20200727" rel="stylesheet"/>
    <link href="../static/css/animate.css" rel="stylesheet"/>
    <link href="../static/css/style.css?v=20200903" rel="stylesheet"/>
    <link href="../static/ruoyi/css/ry-ui.css?v=4.4.0" rel="stylesheet"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-playlist-edit">
        <input name="id" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">歌单名：</label>
            <div class="col-sm-8">
                <input name="name" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">描述：</label>
            <div class="col-sm-8">
                <input name="description" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">图片：</label>
            <div class="col-sm-8">
                <input name="coverImgUrl" class="form-control" type="text">
                <img src="">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-8">
                <select name="status">
                    <option value="1">正常</option>
                    <!--                        <option value="1">删除</option>-->
                    <option value="-1">下架</option>
                </select>
            </div>
        </div>
    </form>
</div>
<a id="scroll-up" href="#" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
<script src="../static/js/jquery.min.js"></script>
<script src="../static/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="../static/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727"></script>
<script src="../static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727"></script>
<script src="../static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="../static/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="../static/ajax/libs/validate/messages_zh.min.js"></script>
<script src="../static/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="../static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- 遮罩层 -->
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="../static/ajax/libs/iCheck/icheck.min.js"></script>
<script src="../static/ajax/libs/layer/layer.min.js"></script>
<script src="../static/ajax/libs/layui/layui.js"></script>
<script src="../static/ruoyi/js/common.js?v=4.4.0"></script>
<script src="../static/ruoyi/js/ry-ui.js?v=4.4.0"></script>

<script type="text/javascript">

    let ctx = storage.get('ctx')

    let prefix = ctx + "playlist";

    let id = $.url.param('id');
    // console.log(id)
    let url = prefix + '/get.do?id=' + id
    $.operate.get(url, function (res) {
        // console.log(res) // 用 js 把查到的东西填充到表单中
        $("input[type='hidden']").val(id);
        $(".col-sm-8 input[type='text']").eq(0).val(res.data.name);
        $(".col-sm-8 input[type='text']").eq(1).val(res.data.description);
        $(".col-sm-8 input[type='text']").eq(2).val(res.data.coverImgUrl);
        $(".col-sm-8 img").attr('src', res.data.coverImgUrl);
        $(".col-sm-8 select").val(res.data.status);
    })

    $("#form-playlist-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/update.do", $('#form-playlist-edit').serialize());
        }
    }


</script>
</body>
</html>